<template>
  <normal-layout page-index="1-2">
    <visit-table :visit-list="visitList" @newRecord="newRecord"></visit-table>
  </normal-layout>
</template>

<script>

  import NormalLayout from "../../layouts/NormalLayout";
  import VisitTable from "../../components/Customer/VisitTable";
  export default {
    name: "visit",
    components: {VisitTable, NormalLayout},
    data(){
      return{
        /*到访记录*/
        visitList: [],
      }
    },
    mounted() {
      this.fetchVisitList();
    },
    methods:{
      async fetchVisitList(){
        this.$axios.get("/get_visit_table").then((res)=>{
          console.log(res);
          this.visitList=res.data;
        })

      },
      newRecord(){
        console.log("页面刷新了刷新了刷新了刷新了刷新了刷新了");
        this.fetchVisitList();
      },
    }
  }
</script>

<style scoped>

</style>
